//Square.hpp
#ifndef _SQUARE_HPP_
#define _SQUARE_HPP_
#include <iostream>
using namespace std;
class Square {
private:
    double sideLength;

public:
    Square();//无参构造
    Square(double sideLength);//带参构造
    Square(const Square& square);//拷贝构造
    ~Square();//析构函数
    void setSideLength(double sideLength);//setter
    double getSideLength();//getter
    double perimeter();//计算并返回周长
    double area();//计算并返回面积
};

Square::Square() {
    this->sideLength = 0;
}

Square::Square(double sideLength) {
    this->sideLength = sideLength;
}

Square::Square(const Square& square) {
    this->sideLength = square.sideLength;
}

Square::~Square() {}

void Square::setSideLength(double sideLength) {
    this->sideLength = sideLength;
}

double Square::getSideLength() {
    return this->sideLength;
}

double Square:: perimeter() {
    return 4 * sideLength;
}

double Square::area() {
    return sideLength * sideLength;
}
#endif